<?php if(!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Sayfalama Oluşturma
 *
 * @param string uri string
 * @param int total rows
 * @param int limit
 * @param int uri segment
 **/
function create_pagination($uri, $total_rows, $limit = 20, $uri_segment = 4) {

    $ci = & get_instance();
    $ci->load->library('pagination');

    $current_page = $ci->uri->segment($uri_segment, 0);

    // Initialize pagination
    $config['base_url']          = site_url($uri);
    $config['total_rows']        = $total_rows; // count all records
    $config['per_page']          = $limit;
    $config['page_query_string'] = TRUE;
    $config['num_links']         = 5;
    $config['full_tag_open']     = '<p class="pagination">';
    $config['full_tag_close']    = '</p>';
    $config['first_link']        = '&lt;&lt;';
    $config['first_tag_open']    = '<span class="first">';
    $config['first_tag_close']   = '</span>';
    $config['prev_link']         = '&lt;';
    $config['prev_tag_open']     = '<span class="prev">';
    $config['prev_tag_close']    = '</span>';
    $config['cur_tag_open']      = '<span class="current">';
    $config['cur_tag_close']     = '</span>';
    $config['num_tag_open']      = '<span>';
    $config['num_tag_close']     = '</span>';
    $config['next_link']         = '&gt;';
    $config['next_tag_open']     = '<span class="next">';
    $config['next_tag_close']    = '</span>';
    $config['last_link']         = '&gt;&gt;';
    $config['last_tag_open']     = '<span class="last">';
    $config['last_tag_close']    = '</span>';

    $ci->pagination->initialize($config);

    $data = array(
        'links' => $ci->pagination->create_links()
	);

	return $ci->template->load_partial('partial/pagination', $data, TRUE);
}

/* End of file pagination_helper.php */
